<?php

function upload()
{
	foreach ($_FILES as $file) {
		if ($file['error']!==0)continue;

		if (is_uploaded_file($file['tmp_name'])) {
			$dir = 'upload'.'/'.date('y/m/d');
			is_dir($dir) or mkdir($dir,0755,true);
			$info = pathinfo($file['name']);
			$dest = $dir.'/'.mt_rand().time().'.'.$info['extension'];
			move_uploaded_file($file['tmp_name'], $dest);
		}
		return $file;
	}



}


?>